UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4+0ePCLWcOndXZ/7JKJA1TdbncYGw52t59ZuL5OUAc=' 
WHERE 
  key_id = 'bf3c9b4dc3697b6c69dc6325dbd779e29165c039729f8353b5bcdc14b54b2543' 
  AND (
    token = 'I4+0ePCLWcOndXZ/7JKJA1TdbncYGw52t59ZuL5OUAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042