UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V5u22JCcINwNKUf5uzyBU1hSVCQGMbrj3COkzY17Al0=' 
WHERE 
  key_id = 'a42532b61e862ecb3301532336067e9c65c65cf97a173902ab2dc351cd9c0b11' 
  AND (
    token = 'V5u22JCcINwNKUf5uzyBU1hSVCQGMbrj3COkzY17Al0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017