UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q1yM2027kowE7TfwbU0vzwHtBM90FdoL1L0l5i1eNOY='
WHERE
key_id = 'cb42a5ff7bf4c3a000be6512a8a58f5e85c150826130e590b54c683a1d426120'
AND (
token = 'q1yM2027kowE7TfwbU0vzwHtBM90FdoL1L0l5i1eNOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)