UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JUPZdyTasF8Vv4vkI7Vq/6GmtbMjv2bExB+hliRb3a8=' 
WHERE 
  key_id = 'bfc4d9d4a27324f4fbc9888c26a4e71ccdf51dede663f0e0aa5ff316ccfc43e2' 
  AND (
    token = 'JUPZdyTasF8Vv4vkI7Vq/6GmtbMjv2bExB+hliRb3a8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047