UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BU52dd6+XawBq1othSnJ/b9aiVaimiNJqM1wXMCtNt4='
WHERE
key_id = 'e5a5a1d8c2a1e23a1ce782cded26650de2b9c6027b27b82032874936e0d178e7'
AND (
token = 'BU52dd6+XawBq1othSnJ/b9aiVaimiNJqM1wXMCtNt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)