UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6a2/nQ4gaaT8/JEVLICVMNV+0SBk6FRyzW6wMJ4MvCE=' 
WHERE 
  key_id = '66393a0d58365a1ba9949e8371b770652f2ee41488749dd2c4b0d2f385c13aa8' 
  AND (
    token = '6a2/nQ4gaaT8/JEVLICVMNV+0SBk6FRyzW6wMJ4MvCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023