UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VYovDhGilaq5tWhBC4UgWZ4NJaNehHm1xn/6a2yjYa8='
WHERE
key_id = 'd5f8832407fe774c10026fed593c4e45c7e85269ce00d2b8d7584f7a0ea8efed'
AND (
token = 'VYovDhGilaq5tWhBC4UgWZ4NJaNehHm1xn/6a2yjYa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)