UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2V5doZxeYYDn8B7LO936udQP1+2Tt307nvtMYibhfWY='
WHERE
key_id = '31852e27625422c3bdc54388f66d48de6893b04f6cc7c1c3d2a05356b67299ed'
AND (
token = '2V5doZxeYYDn8B7LO936udQP1+2Tt307nvtMYibhfWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)