UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5zinT/0VjQ+g/iEMCdot0lxf4Zj5/G/5Kj3ilgwpntU='
WHERE
key_id = '17f666f7a5d939130e3219b66c1da5be632a4372535842a9467408caf817dfe4'
AND (
token = '5zinT/0VjQ+g/iEMCdot0lxf4Zj5/G/5Kj3ilgwpntU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)