UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6XZJIjmGzPcZoC4pqbli0Ey1tnSytfxhzzK+LGbSZwo=' 
WHERE 
  key_id = '0138b386d7730764ead17c3aa5ab0dd001437480600248c2bc70c429cb1945ea' 
  AND (
    token = '6XZJIjmGzPcZoC4pqbli0Ey1tnSytfxhzzK+LGbSZwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052