UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxJzJxkzZjHyk+ZFqnIn8ME0OLaLWLW5uA/t54B8dB0=' 
WHERE 
  key_id = '34f9213d27d190b6cc766537b5c1e0105aad958b7d9eabbde602491d5e44f345' 
  AND (
    token = 'xxJzJxkzZjHyk+ZFqnIn8ME0OLaLWLW5uA/t54B8dB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048