UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPSf6KusaiVaxHr2NvBrLsQsdEt/zw8cBbvNcCES3aU='
WHERE
key_id = 'bbf2761ef8987f04c870bddf3ab04c8915bae733494d59d16111982701a115bb'
AND (
token = 'NPSf6KusaiVaxHr2NvBrLsQsdEt/zw8cBbvNcCES3aU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)