UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zdKUMVQDfPKC7cJYsUgBbcUGFU4YHOOqAfUHa17H4mc='
WHERE
key_id = 'db6a3f867931405547bace3943d32b720c8e2f6f4283a6e781d706f57e4adfba'
AND (
token = 'zdKUMVQDfPKC7cJYsUgBbcUGFU4YHOOqAfUHa17H4mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)