UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sCZbu1ZpjjKqUfGYhhYcU1yaK0+vokufdEYIVEdL9m8='
WHERE
key_id = 'e4a675988cf7ffbd61c208ede99d6469b8fdf0cf6238749eef2b5ffd8e9e58db'
AND (
token = 'sCZbu1ZpjjKqUfGYhhYcU1yaK0+vokufdEYIVEdL9m8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)