UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrzqW1F6tm6r94WUz0Y9fRtzjkoctBERWeTzgtRf7lE=' 
WHERE 
  key_id = '298b051787a3800665e5e5056f9406dd7af657a183e61ab7d909ce6614858818' 
  AND (
    token = 'yrzqW1F6tm6r94WUz0Y9fRtzjkoctBERWeTzgtRf7lE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031