UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AgIY52N63z+ab7E1gAE2U0ay8sWI/MJ92Xr5Ok0IEz0=' 
WHERE 
  key_id = '14ccd39d6cfbddff3caf30714d0eb2b71787aaeb744e569050b440bc9bb45514' 
  AND (
    token = 'AgIY52N63z+ab7E1gAE2U0ay8sWI/MJ92Xr5Ok0IEz0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024