UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ddUEQnHPZJ0kpXNs7c8F+dsQRGo2VIWA2MOHOEZa7Uo='
WHERE
key_id = 'fd87a0fe2bda5ec3620ed6528564363d575edf2f75f4e65fe8088ea729b0488f'
AND (
token = 'ddUEQnHPZJ0kpXNs7c8F+dsQRGo2VIWA2MOHOEZa7Uo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)