UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5cGsnjhXSpb95On0dpk1tyU8vPyPs77IPPhB/TTzJs='
WHERE
key_id = 'd254026c82e24b7d3c73964abab54f1eb2cfa10744d861baf9e8b17bee8b1ae4'
AND (
token = 'S5cGsnjhXSpb95On0dpk1tyU8vPyPs77IPPhB/TTzJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)