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