UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iReRG2DVfcBt8OxQau6X9rDzfAz8gh+vyl75x3SQt3Y=' 
WHERE 
  key_id = '614f29240cf1e34cde92a957a2517f6d89a3780803abd44510aabb68e341aba9' 
  AND (
    token = 'iReRG2DVfcBt8OxQau6X9rDzfAz8gh+vyl75x3SQt3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059