UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'byehr5CsIR/wx99XvV+qKOPongVO/nT+hei8zcHClrk=' 
WHERE 
  key_id = '3a7a72f83bed093f74595dcfe82aa5f091e0cc1e2819abc7dc8457e5d4227ecc' 
  AND (
    token = 'byehr5CsIR/wx99XvV+qKOPongVO/nT+hei8zcHClrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028