UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sa9oJVtWcRGxibcNS/H3sxiaMqgMIapvitFQhi7cwbM='
WHERE
key_id = 'd94b11370759807e139bb03cd4bfb0539f493725631b117f20f9b534447aa7d8'
AND (
token = 'Sa9oJVtWcRGxibcNS/H3sxiaMqgMIapvitFQhi7cwbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)