UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FIVTNBGdnNitxp1EFaf8sEdKxfFwQFey+hXz4cR9y18='
WHERE
key_id = 'b8ee7edf03e84438862f14a6566b43040e45273d2e5bd77961b26d859da03a4e'
AND (
token = 'FIVTNBGdnNitxp1EFaf8sEdKxfFwQFey+hXz4cR9y18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)