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