UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CgNnEjKPI7s79+pG0eQSMg+P6iO7hfZ1ao69+bmxnT0='
WHERE
key_id = '56eca36f39241a717f173faa0e3957c1d61c9b2138736ca8ba47f0978cc51d32'
AND (
token = 'CgNnEjKPI7s79+pG0eQSMg+P6iO7hfZ1ao69+bmxnT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)