UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0OdN71uv7O+9x5QicaI0q5g8o80NC14emXU4QOlIqk=' 
WHERE 
  key_id = '1f3b6e477816ec4d70e2c936d5f2c43240cbe6bded8e88bcde9c6eaf79b53ba4' 
  AND (
    token = 'D0OdN71uv7O+9x5QicaI0q5g8o80NC14emXU4QOlIqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035