UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oC8u3I/omxdjuEhtyBCJpyK2l45L75DH5ONV4b4MsOY='
WHERE
key_id = 'c77f2a8a866ec1a95c2b240f92fbe05cd93d79b14e713d793742ef3ff97fefc6'
AND (
token = 'oC8u3I/omxdjuEhtyBCJpyK2l45L75DH5ONV4b4MsOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)