UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yfFItIf3pkxD11tLmDKETNe+xNHAV1FNfAULivUk2tI=' 
WHERE 
  key_id = 'cbcf668b071478a2975e6e2b821bbe2a70d0dff485ea744132b03743f62b5679' 
  AND (
    token = 'yfFItIf3pkxD11tLmDKETNe+xNHAV1FNfAULivUk2tI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051