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