UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SF3lfz3F35abHZUnqJboPqXNaVdGABJlwFDqXmAwua4=' 
WHERE 
  key_id = '5b3ff8a6d6026010789fb68b64af8a6efa72985759c08b92e248ae4cdb06675d' 
  AND (
    token = 'SF3lfz3F35abHZUnqJboPqXNaVdGABJlwFDqXmAwua4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043