UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZibpVwHB01wUpydrds82vixfaBcNVe2/WKONoHL33eM='
WHERE
key_id = 'fde861b22b9240d2ccb9e44be14e0e24cbf78456e90babb586e06daf3bff0994'
AND (
token = 'ZibpVwHB01wUpydrds82vixfaBcNVe2/WKONoHL33eM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)