UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '417rRV1huFVWcw8wwFgkFE1ZqAYNgL/0ejuFv2vaCKs='
WHERE
key_id = 'f972e3116982e851b2106aa7c0c8ec187d3b5f9e340ba4ad8f59db114d15a40b'
AND (
token = '417rRV1huFVWcw8wwFgkFE1ZqAYNgL/0ejuFv2vaCKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)