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