UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i30zlqgpogt3c1aLTEG9cltjHUHt58jdv276M24rlDk=' 
WHERE 
  key_id = '768aa2f032d6cd12c45b2414dec1e541fc0984f48ec7a562e41f7cb1bfc296e6' 
  AND (
    token = 'i30zlqgpogt3c1aLTEG9cltjHUHt58jdv276M24rlDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053