UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yohichT7s4NpIK/w5TEPrV5cKqkyiIVMuAHiD4cTNRM=' 
WHERE 
  key_id = 'a6e889b7eab060026e9a1c788f8e00cf8114184d7ca043acc68829328441216e' 
  AND (
    token = 'yohichT7s4NpIK/w5TEPrV5cKqkyiIVMuAHiD4cTNRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018