UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jiUFkvc2T/QFMgs4hvB1wDbhgwCFYZCbobB0NXDMfD0=' 
WHERE 
  key_id = '1f12689bcf054a8684fd8657675cc48e9aa3a8685d029a890885d55144be83c9' 
  AND (
    token = 'jiUFkvc2T/QFMgs4hvB1wDbhgwCFYZCbobB0NXDMfD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037