UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BDcxtarkvQUUI6p1z0EcDUUtM88lkxJ1fKRFPTANb2A=' 
WHERE 
  key_id = '79b9a3b2024f2c478039283df12558d4e1ce140d70d481530df4ed07340f0a1c' 
  AND (
    token = 'BDcxtarkvQUUI6p1z0EcDUUtM88lkxJ1fKRFPTANb2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032