UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fUH8jgjFjR6ojz0ENH/LFVIHZL6VC3fSrbxgc5E9rHs=' 
WHERE 
  key_id = '973d204b2e6135c7becc9f0f235abc868210a223ce3722cafd9bdfec3f232242' 
  AND (
    token = 'fUH8jgjFjR6ojz0ENH/LFVIHZL6VC3fSrbxgc5E9rHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037