UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pHue1y9/n/2ClnqtFUcLCHjgbr/8Qp3LRTULq3uQvXw='
WHERE
key_id = 'b9a7c0cddfe2f0784f8e843817c0b14ea8f5707551bafd0bba62baf36e733e51'
AND (
token = 'pHue1y9/n/2ClnqtFUcLCHjgbr/8Qp3LRTULq3uQvXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)