UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'btnmfshVXbDmPmtILAGhCkBBrFWjqagMX0TqBK6iXhY='
WHERE
key_id = '8ef3c4da4cf2666dce04407ccdc9ac33ef1689bb22aed1fd6bf42a463fde3d6a'
AND (
token = 'btnmfshVXbDmPmtILAGhCkBBrFWjqagMX0TqBK6iXhY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)