UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GNhC/Hl6OhDHGeN2GmWY9FHXDWCr0Y7b6Z9qYjMPXmo=' 
WHERE 
  key_id = 'a76d2087deec1f4e1251b7608883535470296a5a17f8c7091e5e6d82189f0372' 
  AND (
    token = 'GNhC/Hl6OhDHGeN2GmWY9FHXDWCr0Y7b6Z9qYjMPXmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030