UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jjW1KgRLESu0Gi80FmvZYw0Hsfttudi4cbGPldf+Fqw='
WHERE
key_id = 'c5a9269d86f9e59cbfe77174322c1cd20773065f829e4e0e5c171ca6e458a2c9'
AND (
token = 'jjW1KgRLESu0Gi80FmvZYw0Hsfttudi4cbGPldf+Fqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)