UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oIEBsCPlt5n8+bgWETuFlO0jqUx75MH/s7Uxv5fu+dk='
WHERE
key_id = 'e011abab5ff5244b810fa6de760052748a866d0304b0f4f1a3d984d99f1d65ca'
AND (
token = 'oIEBsCPlt5n8+bgWETuFlO0jqUx75MH/s7Uxv5fu+dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)