UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7lOq1F0dE50a1Q4WukDaofk1JG3Dy+SuWnSgBDxCOm0=' 
WHERE 
  key_id = '1aa1e937080ae748ebb8a2a34a8c1dcf434d9033d34c7188258798be5f80305d' 
  AND (
    token = '7lOq1F0dE50a1Q4WukDaofk1JG3Dy+SuWnSgBDxCOm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041